import { createApp } from 'vue';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import ElementPlus from 'element-plus';
import App from './App.vue';
import router from './router';
import './assets/global.scss';
import * as ELIcons from '@element-plus/icons-vue';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import directives from './directives';


// 使用 pinia-plugin-persistedstate 插件
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

const app = createApp(App);
app.use(pinia);
app.use(router);
app.use(directives);  // 注册全局自定义指令

app.mount('#app');
for (let iconName in ELIcons) {
  app.component(iconName, ELIcons[iconName]);
}
app.use(ElementPlus, {
  locale: zhCn,
});
